package com.sxz.sbs.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.sxz.sbs.R;
import com.sxz.sbs.applibrary.component.LabelTextView;

/**
 * 更新记录
 * @author tian
 */

public class UpdateRecordDialog extends Dialog {


    private ImageView ivClose;
    private LabelTextView toIntent;
    private LabelTextView toUpdate;
    private OnUpdateDialogListener onUpdateDialogListener;

    public void setOnUpdateDialogListener(OnUpdateDialogListener onUpdateDialogListener) {
        this.onUpdateDialogListener = onUpdateDialogListener;
    }

    public UpdateRecordDialog(Context context) {
        super(context, R.style.Theme_Dialog_From_Bottom);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.custom_update_record_layout);
        ivClose = findViewById(R.id.iv_update_close);
        toIntent =  findViewById(R.id.ltv_to_intent);
        toUpdate =  findViewById(R.id.ltv_to_update);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
        ivClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
               if (onUpdateDialogListener != null) {
                   onUpdateDialogListener.onClose(UpdateRecordDialog.this);
               }
            }
        });
        toIntent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (onUpdateDialogListener != null) {
                    onUpdateDialogListener.onToIntent(UpdateRecordDialog.this);
                }
            }
        });
        toUpdate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (onUpdateDialogListener != null) {
                    onUpdateDialogListener.onToUpdate(UpdateRecordDialog.this);
                }
            }
        });

    }
    public interface OnUpdateDialogListener {
        void onClose(UpdateRecordDialog dialog);
        void onToIntent(UpdateRecordDialog dialog);
        void onToUpdate(UpdateRecordDialog dialog);
    }


}

